
function showturnlist(ownid, userid){
	var url = location.href;  // entire url including querystring - also: window.location.href;
	var baseURL = url.substring(0, url.indexOf('/', 50));
	
		
	result = $.ajax({
		type: 'POST',
		async: false,
		url : "/sailorbase-a/sailorbase-a/public/Turnplaner/getturnsforinvite",
		data: ({
			id: ownid
			})
	}).responseText;
	
	result = result.evalJSON();
	
	var text = "";
	for(var i = 0; i < result.length; ++i){
		text = text 
					+ "<a href='/sailorbase-a/sailorbase-a/public/Crewmitglieder/inviteforturn/turnid/"
					+ result[i]['id']
					+ "/userid/"
					+ userid
					+ "/myid/"
					+ ownid
					+ "'>"
					+ result[i]['name']
					+ "</a>";
	}
	
	var ScreenWidth=window.screen.width;
	var ScreenHeight=window.screen.height;
	var movefromedge=0;
	placementx=(ScreenWidth/2);
	placementy=(ScreenHeight/3);
	weite = ScreenWidth/8;
	hohe =ScreenHeight/8;
	WinPop=window.open("About:Blank","","width="+weite+",height="+hohe+",toolbar=0,location=0,directories=0,status=0,scrollbars=yes,menubar=0,resizable=0,left="+placementx+",top="+placementy+",scre enX="+placementx+",screenY="+placementy+",");
	//WinPop.document.write('<html>\n<head>\n</head>\n<body>'+result+'</body></html>');
	WinPop.document.write('<html>\n<head>\n</head>\n<body>'+text+'</body></html>');
}


function InfoBoxAusblenden() {
      document.getElementById('InfoBox').style.visibility = "hidden";
}

function InfoBoxAnzeigenzwei(e,ownid,offsetX,offsetY, userid)
{

	result = $.ajax({
		type: 'POST',
		async: false,
		url : "/sailorbase-a/sailorbase-a/public/Turnplaner/getturnsforinvite",
		data: ({
			id: ownid
			})
	}).responseText;
	
	result = result.evalJSON();
	
	var text = "";
	for(var i = 0; i < result.length; ++i){
		text = text 
					+ "<a href='/sailorbase-a/sailorbase-a/public/Crewmitglieder/inviteforturn/turnid/"
					+ result[i]['id']
					+ "/userid/"
					+ userid
					+ "/myid/"
					+ ownid
					+ "'>"
					+ result[i]['name']
					+ "</a><br />";
	}
	text = text 
			+ '<a onclick="InfoBoxAusblenden();" href="javascript:void(0)" class="InfoBoxText">Ausblenden</a>';

        if (offsetX) {offsetx=offsetX;} else {offsetx=20;}
        if (offsetY) {offsety=offsetY;} else {offsety=0;}
        var PositionX = 0;
        var PositionY = 0;
        if (!e) var e = window.event;
        if (e.pageX || e.pageY)
        {
                PositionX = e.pageX;
                PositionY = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
                PositionX = e.clientX + document.body.scrollLeft;
                PositionY = e.clientY + document.body.scrollTop;
        }
        document.getElementById("BoxInhalte").innerHTML = text;
        document.getElementById('InfoBox').style.left = (PositionX+offsetx)+"px";
        document.getElementById('InfoBox').style.top = (PositionY+offsety)+"px";
        document.getElementById('InfoBox').style.visibility = "visible";
}
